package com.cy.pj.common.aspect;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.Signature;
import org.aspectj.lang.annotation.AfterThrowing;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;

import lombok.extern.slf4j.Slf4j;

@Component
@Slf4j
@Aspect
/**
 * Serivce异常记录方法,会记录异常,但是不会截断异常
 */
public class ExceptionAspect {
	@AfterThrowing(pointcut = "bean(*ServiceImpl)", throwing = "e")
	public void doLogException(JoinPoint jionPoint, Throwable e) {

		Signature signature = jionPoint.getSignature();
		
		log.info("{}ExceptionAspect异常信息:{}", signature.getName(),e.getMessage());
	}

}
